<template>
    <!-- 主体信息 -->
      <div id="mainInfoCon" class="con" v-if="!isView">
          <div class="tabs-title" id="mainInfo">主体信息</div>
          <div style="width: 100%" class="form">
              <el-form
                  :model="mainInfo"
                  label-width="150px"
                  :rules="rulesMain"
                  ref="rulesMain"
                  class="demo-ruleForm"
              >
                  <div class="mainTitle">甲方信息</div>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="招标：">
                                  <el-input
                                      v-model="
                                          mainInfo.firstParty.biddingName
                                      "
                                      autocomplete="off"
                                      readonly
                                      :disabled="disabled"
                                  >
                                      <i
                                          class="
                                              el-icon-document-copy
                                          "
                                          slot="suffix"
                                          @click="handleBidding"
                                      >
                                      </i>
                                  </el-input>
                                  <el-button v-if="mainInfo.secondParty.biddingId" class="btn-blue" style="margin-left:5px" @click="showBinding">查看</el-button>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item
                                  label="统一社会信用代码："
                                  prop="firstParty.socialCode"
                              >
                                  <el-input
                                      v-model="
                                          mainInfo.firstParty
                                              .socialCode
                                      "
                                      autocomplete="off"
                                      disabled
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item
                                  label="单位名称："
                                  prop="firstParty.name"
                              >
                                  <el-input
                                      v-model="
                                          mainInfo.firstParty.name
                                      "
                                      autocomplete="off"
                                      readonly
                                  >
                                      <i
                                          class="
                                              el-icon-document-copy
                                          "
                                          slot="suffix"
                                          @click="handleName"
                                      >
                                      </i>
                                  </el-input>
                              </el-form-item>
                          </el-col>
                           <el-col :span="12">
                              <el-form-item
                                  label="法人代表联系电话："
                              >
                                  <el-input
                                      v-model="
                                          mainInfo.firstParty.phone
                                      "
                                      autocomplete="off"
                                      maxlength="11"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item
                                  label="法人代表："
                              >
                                  <el-input
                                      v-model="
                                          mainInfo.firstParty
                                              .legalRepresentative
                                      "
                                      autocomplete="off"
                                      minlength="0"
                                      maxlength="20"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                         <el-col :span="12">
                              <el-form-item
                                  label="开户账号："
                              >
                                  <el-input
                                      v-model="
                                          mainInfo.firstParty
                                              .accountNumber
                                      "
                                      autocomplete="off"
                                      v-enter-number
                                      minlength="0"
                                      maxlength="100"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item
                                  label="开户银行："
                              >
                                  <el-input
                                      v-model="
                                          mainInfo.firstParty
                                              .bankName
                                      "
                                      autocomplete="off"
                                      minlength="0"
                                      maxlength="100"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item label="传 真：">
                                  <el-input
                                      v-model="
                                          mainInfo.firstParty.fax
                                      "
                                      autocomplete="off"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item
                                  label="邮政编码："
                              >
                                  <el-input
                                      v-model="
                                          mainInfo.firstParty
                                              .postalCode
                                      "
                                      autocomplete="off"
                                      v-enter-number
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                           <el-col :span="12">
                              <el-form-item label="委托代理联系电话："  prop="firstParty.principalAgentPhone">
                                  <el-input
                                      v-model="
                                          mainInfo.firstParty
                                              .principalAgentPhone
                                      "
                                      autocomplete="off"
                                      minlength="0"
                                      maxlength="100"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="委托代理："  prop="firstParty.principalAgent">
                                  <el-input
                                      v-model="
                                          mainInfo.firstParty
                                              .principalAgent
                                      "
                                      autocomplete="off"
                                      minlength="0"
                                      maxlength="20"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="单位地址：">
                                  <SelectAddr v-model="mainInfo.firstParty.address"
                                      lazy
                                      showCountry
                                  ></SelectAddr>
                              </el-form-item>
                          </el-col>
                      </el-row>
                  <div class="mainTitle">乙方信息</div>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="法人代表：">
                                  <el-input
                                      v-model="
                                          mainInfo.secondParty
                                              .legalRepresentative
                                      "
                                      autocomplete="off"
                                      maxlength="100"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item
                                  label="乙方名称："
                                  prop="secondParty.orgName"
                              >
                                  <el-input
                                      v-model="
                                          mainInfo.secondParty.orgName
                                      "
                                      autocomplete="off"
                                      readonly
                                  >
                                      <i
                                          class="
                                              el-icon-document-copy
                                          "
                                          slot="suffix"
                                          id="select"
                                          @click="selectOrg"
                                      >
                                      </i>
                                  </el-input>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="传 真：">
                                  <el-input
                                      v-model="
                                          mainInfo.secondParty.fax
                                      "
                                      autocomplete="off"
                                      minlength="0"
                                      maxlength="100"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item label="统一社会信用代码：">
                                  <el-input v-model="mainInfo.secondParty.socialCode" autocomplete="off"></el-input>
                              </el-form-item>
                          </el-col>

                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="开户银行：">
                                  <el-input
                                      v-model="
                                          mainInfo.secondParty.bankName
                                      "
                                      autocomplete="off"
                                      maxlength="100"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item
                                  label="法人代表联系电话："
                              >
                                  <el-input
                                      v-model="
                                          mainInfo.secondParty.phone
                                      "
                                      autocomplete="off"
                                      maxlength="100"
                                  ></el-input>
                              </el-form-item>
                          </el-col>

                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="邮政编码：">
                                  <el-input
                                      v-model="
                                          mainInfo.secondParty
                                              .postalCode
                                      "
                                      autocomplete="off"
                                      v-enter-number
                                      maxlength="6"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item label="开户账号：">
                                  <el-input
                                      v-model="
                                          mainInfo.secondParty
                                              .accountNumber
                                      "
                                      autocomplete="off"
                                      v-enter-number
                                      maxlength="100"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="委托代理：">
                                  <el-input
                                      v-model="
                                          mainInfo.secondParty
                                              .principalAgent
                                      "
                                      autocomplete="off"
                                      minlength="0"
                                      maxlength="100"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item label="委托代理联系电话：">
                                  <el-input
                                      v-model="
                                          mainInfo.secondParty
                                              .principalAgentPhone
                                      "
                                      autocomplete="off"
                                      minlength="0"
                                      maxlength="100"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="单位地址：">
                                  <SelectAddr v-model="mainInfo.secondParty.address"
                                      lazy
                                      showCountry
                                  ></SelectAddr>
                              </el-form-item>
                          </el-col>
                      </el-row>
                  <div class="mainTitle">公证信息</div>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="公证机关：">
                                  <el-input
                                      v-model="
                                          mainInfo.notarization.name
                                      "
                                      autocomplete="off"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item label="公证日期：">
                                  <el-date-picker
                                      type="date"
                                      value-format="yyyy-MM-dd"
                                      placeholder="选择日期"
                                      v-model="
                                          mainInfo.notarization
                                              .notaryTime
                                      "
                                      style="width: 100%"
                                  ></el-date-picker>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="开户银行：">
                                  <el-input
                                      v-model="
                                          mainInfo.notarization
                                              .bankName
                                      "
                                      autocomplete="off"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item label="开户账号：">
                                  <el-input
                                      v-model="
                                          mainInfo.notarization
                                              .accountNumber
                                      "
                                      autocomplete="off"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="24">
                              <el-form-item label="公证意见：">
                                  <el-input
                                      type="textarea"
                                      v-model="
                                          mainInfo.notarization
                                              .opinion
                                      "
                                      autocomplete="off"
                                  ></el-input>
                              </el-form-item>
                          </el-col>
                      </el-row>
              </el-form>
          </div>
      </div>
      <!-- 主体信息 -->
      <div id="mainInfoCon" class="con" v-else>
          <div class="tabs-title" id="mainInfo">主体信息</div>
          <div style="width: 100%" class="form">
              <el-form
                  :model="mainInfo"
                  label-width="150px"
                  :rules="rulesMain"
                  ref="rulesMain"
                  class="demo-ruleForm"
              >
                  <div class="mainTitle">甲方信息</div>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="招标：">
                                  <span>{{ mainInfo.firstParty.biddingName }}</span>
                                  <el-button v-if="mainInfo.secondParty.biddingId" class="btn-blue" style="margin-left:5px" @click="showBinding">查看</el-button>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item
                                  label="统一社会信用代码："
                                  prop="firstParty.socialCode"
                              >
                                  <span>{{ mainInfo.firstParty.socialCode }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item
                                  label="单位名称："
                                  prop="firstParty.name"
                              >
                                  <span>{{ mainInfo.firstParty.name }}</span>
                              </el-form-item>
                          </el-col>
                           <el-col :span="12">
                              <el-form-item
                                  label="法人代表联系电话："
                              >
                                  <span>{{ mainInfo.firstParty.phone }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item
                                  label="法人代表："
                              >
                                  <span>{{ mainInfo.firstParty.legalRepresentative }}</span>
                              </el-form-item>
                          </el-col>
                         <el-col :span="12">
                              <el-form-item
                                  label="开户账号："
                              >
                                  <span>{{ mainInfo.firstParty.accountNumber }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item
                                  label="开户银行："
                              >
                                  <span>{{ mainInfo.firstParty.bankName }}</span>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item label="传 真：">
                                  <span>{{ mainInfo.firstParty.fax }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item
                                  label="邮政编码："
                              >
                                  <span>{{ mainInfo.firstParty.postalCode }}</span>
                              </el-form-item>
                          </el-col>
                           <el-col :span="12">
                              <el-form-item label="委托代理联系电话："  prop="firstParty.principalAgentPhone">
                                  <span>{{ mainInfo.firstParty.principalAgentPhone }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="委托代理："  prop="firstParty.principalAgent">
                                  <span>{{ mainInfo.firstParty.principalAgent }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="单位地址：">
                                  <span> {{ showAddress(mainInfo.firstParty.address) }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
                  <div class="mainTitle">乙方信息</div>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="法人代表：">
                                  <span>{{ mainInfo.secondParty.legalRepresentative }}</span>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item
                                  label="乙方名称："
                                  prop="secondParty.orgName"
                              >
                                  <span>{{ mainInfo.secondParty.orgName }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="传 真：">
                                  <span>{{ mainInfo.secondParty.fax }}</span>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item label="统一社会信用代码：">
                                  <span>{{ mainInfo.secondParty.socialCode }}</span>
                              </el-form-item>
                          </el-col>

                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="开户银行：">
                                  <span>{{ mainInfo.secondParty.bankName }}</span>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item
                                  label="法人代表联系电话："
                              >
                                  <span>{{ mainInfo.secondParty.phone }}</span>
                              </el-form-item>
                          </el-col>

                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="邮政编码：">
                                  <span>{{ mainInfo.secondParty.postalCode }}</span>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item label="开户账号：">
                                  <span>{{ mainInfo.secondParty.accountNumber }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="委托代理：">
                                  <span>{{ mainInfo.secondParty.principalAgent }}</span>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item label="委托代理联系电话：">
                                  <span>{{ mainInfo.secondParty.principalAgentPhone }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="单位地址：">
                                  <span> {{ showAddress(mainInfo.secondParty.address) }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
                  <div class="mainTitle">公证信息</div>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="公证机关：">
                                  <span>{{ mainInfo.notarization.name }}</span>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item label="公证日期：">
                                  <span>{{ mainInfo.notarization.notaryTime }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="12">
                              <el-form-item label="开户银行：">
                                  <span>{{ mainInfo.notarization.bankName }}</span>
                              </el-form-item>
                          </el-col>
                          <el-col :span="12">
                              <el-form-item label="开户账号：">
                                  <span>{{ mainInfo.notarization.accountNumber }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
                      <el-row>
                          <el-col :span="24">
                              <el-form-item label="公证意见：">
                                  <span>{{ mainInfo.notarization.opinion }}</span>
                              </el-form-item>
                          </el-col>
                      </el-row>
              </el-form>
          </div>
      </div>
  </template>

<script>
import { selectDataClient } from '@/utils/common'
import SelectAddr from '@/components/common/addrComp'
import service from '@/utils/request'
import fn from '@/utils/checkEmpty.js'
import { showBinding } from '@/pages/subcontract/common/contractCom.js'
export default {
    model: {
        prop: 'mainInfo',
        event: 'change'
    },
    props: {
        mainInfo: {
            type: Object,
            default: function () {
                return {
                    secondParty: {
                        'accountNumber': '',
                        'address': '',
                        'bankName': '',
                        'billId': '',
                        'fax': '',
                        'legalRepresentative': '',
                        'orgId': '',
                        'orgName': '',
                        'phone': '',
                        'postalCode': '',
                        'principalAgent': '',
                        'principalAgentPhone': '',
                        'socialCode': '',
                        'sourceId': this.$route.query.billid,
                    },
                    serverUnit: {
                        'accountNumber': '',
                        'bankName': '',
                        'billId': '',
                        'fax': '',
                        'id': '',
                        'legalRepresentative': '',
                        'name': '',
                        'phone': '',
                        'postalCode': '',
                        'principalAgent': '',
                        'principalAgentPhone': '',
                        'socialCode': '',
                        'sourceId': this.$route.query.billid,
                    },
                    notarization: {
                        'accountNumber': '',
                        'bankName': '',
                        'billId': '',
                        'name': '',
                        'notaryTime': null,
                        'opinion': '',
                        'sourceId': this.$route.query.billid,
                    },
                    firstParty: {
                        'accountNumber': '',
                        'address': '',
                        'anotherName': '',
                        'bankName': '',
                        'biddingId': '',
                        'biddingName': '',
                        'billId': '',
                        'dtlId': '',
                        'fax': '',
                        'legalRepresentative': '',
                        'name': '',
                        'phone': '',
                        'postalCode': '',
                        'principalAgent': '',
                        'principalAgentPhone': '',
                        'socialCode': '',
                        'sourceId': this.$route.query.billid,
                    }
                }
            }
        },
        formData: {
            type: Object,
            default: function () {
                return {}
            }
        },
        contractListTable: {
            type: Array,
            default: function () {
                return []
            }
        },
        isView: {
            type: Boolean,
            default: false
        },
        biddingPath: {
            type: String
        }
    },
    watch: {
        mainInfo: {
            handler (newName) {
                this.$emit('change', newName)
            },
            immediate: false,
            deep: true
        },
    },
    computed: {
        showAddress () {
            return value=>{
                if(!value) return ''
                try {
                    let obj = JSON.parse(value)
                    const  address = obj.address ? obj.address.join('-') : ''
                    const  detail = obj.detail
                    let str = ''
                    if(address && detail) {
                        str = address + '-' + detail
                    }else if(!address  && detail) {
                        str = detail
                    }else if(address  && !detail) {
                        str = address
                    }
                    return str
                }
                catch(err) {
                    return value
                }

            }
        }
    },
    components: {
        SelectAddr,
    },
    data () {
        return {
            disabled: false,
            rulesMain: {
                'secondParty.orgName': [
                    {
                        required: true,
                        message: '请选择本机构及其上级单位的数据',
                        trigger: 'blur'
                    }
                ],
                'firstParty.name': [
                    { required: true, message: '请选择数据', trigger: 'blur' }
                ],
                'firstParty.legalRepresentative': [
                    {
                        required: true,
                        message: '请输入法人代表',
                        trigger: 'blur'
                    },
                    { validator: this.textLen, trigger: 'blur' }
                ],
                'firstParty.phone': [
                    {
                        required: false,
                        message: '请输入电话号码',
                        trigger: 'blur'
                    },
                    { validator: this.phoneTest, trigger: 'blur' }
                ],
                'firstParty.bankName': [
                    {
                        required: true,
                        message: '请输入开户银行',
                        trigger: 'blur'
                    }
                ],
                'firstParty.accountNumber': [
                    {
                        required: true,
                        message: '请输入开户账号',
                        trigger: 'blur'
                    }
                ],
                'firstParty.socialCode': [
                    {
                        required: true,
                        message: '请输入统一社会信用代码',
                        trigger: 'blur'
                    }
                ],
                'firstParty.postalCode': [
                    {
                        required: false,
                        validator: this.postalCodeTest,
                        trigger: 'change'
                    }
                ],
                'firstParty.principalAgentPhone': [
                    {
                        required: true,
                        message: '请输入委托代理联系电话',
                        trigger: 'blur'
                    },
                    { validator: this.phoneTest, trigger: 'blur' }
                ],
                'firstParty.principalAgent': [
                    {
                        required: true,
                        message: '请输入委托代理',
                        trigger: 'blur'
                    },
                ]
            },
        }
    },
    methods: {
        //选择本机级上级机构
        selectOrg () {
            selectDataClient({
                SelectServiceToken: '/hr/org/getParentOrg', // 客户端对应方法名
                IsSingleMode: true, // 是否单选 true 单选 false 多选
                SelectedIDs: [], // 已选中id
                Title: '选择机构' // 标题
            }).then(val => {
                this.mainInfo.secondParty.orgName = val[0].orgName
                this.mainInfo.secondParty.orgId = val[0].orgId
            })
        },
        //点击招标弹窗
        handleBidding () {
            if(this.disabled) return
            if (this.mainInfo.firstParty.name || this.flag4) {
                this.clientPop(
                    'info',
                    '是否更改？更改后将清空乙方、合同清单信息，请确认！',
                    ()=>{
                        this.$emit('clearInfo')
                        this.biddingClient()
                    }
                )
            }else{
                this.biddingClient()
            }
        },
        //弹出招标弹窗
        biddingClient () {
            this.$emit('biddingClient')
        },
        //点击乙方名称弹窗
        handleName () {
            this.$emit('handleName')
        },
        handleNameServe () {
            let InitParamsStr = JSON.stringify({
                'businessUnitTypes': [],
                'keyword': '',
                'limit': 10,
                'orgId': '',
                'outerTypes': [],
                'page': 1,
                'states': [],
                'type': [0, 1, 2]
            })
            let ids = this.mainInfo.serverUnit.id ? [this.mainInfo.serverUnit.id] : []
            selectDataClient({
                SelectServiceToken: 'GeneralSelectOuter', // 客户端对应方法名
                IsSingleMode: true, // 是否单选 true 单选 false 多选
                SelectedIDs: ids, // 已选中id
                InitParamsStr: InitParamsStr,
                Title: '选择外包方' // 标题
            }).then(val => {
                this.mainInfo.serverUnit.id = val[0].id
                this.mainInfo.serverUnit.name = val[0].outerName
                service.httpPostForm({
                    url: '/outer/outer/get/outer',
                    params: {
                        id: val[0].id
                    },
                }).then(res=>{
                    this.mainInfo.serverUnit.socialCode = res.creditCode //社会信用代码
                    this.mainInfo.serverUnit.legalRepresentative = res.deputy //法人代表
                    this.mainInfo.serverUnit.fax = res.fax //传真
                    this.mainInfo.serverUnit.phone = res.contactTel //电话
                    this.mainInfo.serverUnit.address = res.registerAddInfo //注册地址
                    this.mainInfo.serverUnit.postalCode = res.postCode //邮政编码
                })
            })
        },
        //判断数据是否为空
        checkEmpty (datas) {
            return fn.checkEmpty(datas)
        },
        //验证邮政编码
        postalCodeTest (rule, value, callback) {
            if (value === undefined || value === '' || value === null || value === 'null') {
                callback()
            }
            else if (value.length == 6) {
                callback()
            } else {
                callback(new Error('请输入6位数'))
            }
        },
        //验证电话号码
        phoneTest (rule, value, callback) {
            const reg = /^1\d{10}$|^(0\d{2,3}-?|\(0\d{2,3}\))?[1-9]\d{4,7}(-\d{1,8})?$/
            if (reg.test(value)) {
                callback()
            }
            else if(value === null || value === '' ) {
                callback()
            }
            else {
                callback(new Error('请输入有效电话'))
            }
        },
        //验证法人代表
        textLen (rule, value, callback) {
            if (value.length < 20) {
                callback()
            } else {
                callback(new Error('不能超过20个字'))
            }
        },
        //查看招标
        showBinding () {
            showBinding(this.biddingPath, this.mainInfo.secondParty.biddingId)
        },
    },
}
</script>

  <style lang="scss" scoped>
  .mainTitle {
      box-sizing: border-box;
      width: 100%;
      height: 40px;
      line-height: 40px;
      background: rgb(246, 246, 246);
      border: 1px solid rgb(236, 236, 236);
      margin: auto;
      margin-bottom: 15px;
      padding-left: 10px;
  }
  </style>